priority 1

###### TeX life easier ######

snippet "(\S*\\\S+\{\S+\}\S*)tps" "TeX or PDF string" rA
\texorpdfstring{`!p snip.rv = match.group(1)`}{}$0
endsnippet

snippet "([\s|~])ct" "cite" r
`!p snip.rv = match.group(1)`\cite{$1}$0
endsnippet

snippet "\\mn" "mynote" rA
\mynote{$1}$0
endsnippet

snippet eq "equation environment" b
\begin{equation}
	\label{eq:$1}
	$0
\end{equation}
endsnippet

### Figure

snippet fig "figure environment" b
\begin{figure}[${1:htpb}]
	\centering
	\includegraphics[width=0.${2:8}\textwidth]{${3:name.ext}}
	\caption{$4}%
	\label{fig:${3/(\w+)\.\w+/$1/}}
\end{figure}
$0
endsnippet

snippet figs "figures environment" b
\begin{figure}[${1:htpb}]
	\centering
	$0
	\caption{$3}%
	\label{fig:$2}
\end{figure}
endsnippet

snippet subfig "subfigure environment"
\begin{subfigure}[${1:b}]{0.${2:3}\textwidth}
\begin{center}
	\includegraphics[width=\textwidth]{${3:name.ext}}
\end{center}
\caption{$4}%
\label{fig:${3/(\w+)\.\w+/$1/}}
\end{subfigure}
$0
endsnippet

### Section

snippet sec "section" b
\section{$1}%
\label{sec:${2:${1/(\w+)(\s|-)?/(?2:\L$1\E_:\L$1\E)/g}}}
$0
endsnippet

snippet ssec "subsection" b
\subsection{$1}%
\label{ssec:${2:${1/(\w+)(\s|-)?/(?2:\L$1\E_:\L$1\E)/g}}}
$0
endsnippet

snippet sssec "subsubsection" b
\subsubsection{$1}%
\label{sssec:${2:${1/(\w+)(\s|-)?/(?2:\L$1\E_:\L$1\E)/g}}}
$0
endsnippet

### Reference

snippet eqr "reference to an equation"
Equation~\ref{eq:$1}$0
endsnippet

snippet figr "reference to a figure"
Figure~\ref{fig:$1}$0
endsnippet

snippet tabr "reference to a table"
Table~\ref{tab:$1}$0
endsnippet

snippet secr "reference to a section"
Section~\ref{${1}sec:$2}$0
endsnippet

###### siunitx snippets ######

### Generic

snippet "(?<!to)(?<!to-)(?<![0-9])(?<!\.)(?<!\))(?<!e)(?<!e-)([-|+]?[0-9]+\.?[0-9]*(\([0-9]+\))*(e-?[0-9]+)*|e-?[0-9]+)si" "siunitx" rA
\qty{`!p snip.rv = match.group(1)`}{$1}$0
endsnippet

snippet "([-|+]?[0-9]+\.?[0-9]*(\([0-9]+\))*(e-?[0-9]+)*|e-?[0-9]+)to([-|+]?[0-9]+\.?[0-9]*(\([0-9]+\))*(e-?[0-9]+)*|e-?[0-9]+)si" "siunitx range" rA
\qtyrange{`!p snip.rv = match.group(1)`}{`!p snip.rv = match.group(4)`}{$1}$0
endsnippet

snippet "permode" "siunitx per-mode" rA
[per-mode=$0]
endsnippet

### Specific units

snippet "([-|+]?[0-9]+\.?[0-9]*)degc" "degree Celsius" rA
\qty{`!p snip.rv = match.group(1)`}{\degreeCelsius}$0
endsnippet

snippet "([-|+]?[0-9]+\.?[0-9]*)cm-1" "cm-1" rA
\qty{`!p snip.rv = match.group(1)`}{\per\cm}$0
endsnippet

###### mhchem snippets ######

snippet "\\ce" "mhchem" rA
\ce{$1}$0
endsnippet

###### Glossary ######

### Generic writing

### My PhD work, mhchem package used

snippet "(^|\s|\(|{)vo2" "VO2" r
`!p snip.rv = match.group(1)`\ce{VO2}
endsnippet

snippet temav "TEMAV"
tetrakis(ethylmethylamino)vanadium(IV)
endsnippet

snippet teoge "Ge ethoxide"
germanium(IV) ethoxide
endsnippet

snippet mp "M phase"
\textit{M\textsubscript{$1}}
endsnippet

snippet rp "R phase"
\textit{R}
endsnippet

snippet p21c "P21/c space group"
\textit{P}2\textsubscript{1}/\textit{c}
endsnippet

snippet p42mnm "P42/mnm space group"
\textit{P}4\textsubscript{2}/\textit{mnm}
endsnippet

snippet "(^|\s|\(|{)tc" "critical temperature" r
`!p snip.rv = match.group(1)`$T_{\textit{c}}$
endsnippet

###### Cover letter ######

### Template

snippet cl "cover letter" b
\documentclass[
company={$1},
position={$2}
]{cl}

\usepackage{cl}

\begin{document}

\begin{letter}{
	\textbf{${3:company full name}} \\\\
	${4:first line} \\\\
	${5:street name} \\\\
	${6:city name} \\\\
	${7:postcode}
}

%\renewcommand{\today}{}

\opening{Dear Recruiting Team,}

${0:main text}

\closing{Yours sincerely,}

\end{letter}

\end{document}
endsnippet

### Macros

snippet cpn "company" wA
\company{}
endsnippet

snippet pst "position" wA
\position{}
endsnippet
